package com.ahu.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * Author: Zhang Dongwei
 * Date: 2022/5/12 12:24
 */
// 等价于<bean id="user" class="com.ahu.pojo.User"/>
// @Component 组件
@Component
@Scope("singleton")
public class User {

    public String name;

    //    相当于<property name="name" value = "张冬伟"/>
    @Value("张冬伟")
    public void setName(String name) {
        this.name = name;
    }
}
